package ru.osu.acm.testing.solutions;

import java.io.*;
import java.util.StringTokenizer;
import java.util.ArrayList;

/**
 * User: Aleksey
 * Date: 16.01.2009
 * Time: 1:51:36
 */
public class Task14Gen implements Runnable {
    private static BufferedReader br = null;
    private static PrintWriter pw = null;
    private static StringTokenizer st = new StringTokenizer("");

    private void nline() {
        try {
            st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
            throw new RuntimeException("RuntimeException");
        }
    }

    private int ni() {
        while (!st.hasMoreTokens()) nline();
        return Integer.parseInt(st.nextToken());
    }

    private long nl() {
        while (!st.hasMoreTokens()) nline();
        return Long.parseLong(st.nextToken());
    }

    private double nd() {
        while (!st.hasMoreTokens()) nline();
        return Double.parseDouble(st.nextToken());
    }

    private String ns() {
        while (!st.hasMoreTokens()) nline();
        return st.nextToken();
    }

    private void solve() {
        int n = ni();
        int sum = n + 1;
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = ni();
            sum += a[i];
        }
        pw.println(sum);
        pw.print(n);
        for (int i = 0; i < n; i++) {
            pw.print(" " + (i+1));
        }
        pw.println();
        int k = n + 1;

        ArrayList<String> ar = new ArrayList<String>();
        for (int i = 0; i < n; i++) {
            pw.print((a[i] + 1) + " 0");
            for (int j = 0; j < a[i]; j++) {
                pw.print(" " + (k++));
                ar.add("1 " + (i+1));
            }
            pw.println();
        }
        for (String s : ar) {
            pw.println(s);
        }
    }

    public void run() {
        solve();
        pw.close();
        Task14.main(null);
    }

    public static void main(String[] args) {
        /*br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new OutputStreamWriter(System.out));*/

        int counter = 0;
        try {
            BufferedReader br1 = new BufferedReader(new FileReader("counter.txt"));
            counter = Integer.parseInt(br1.readLine());
            br1.close();
        }
        catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        catch (IOException e) {
            e.printStackTrace();
        }

        try {
            br = new BufferedReader(new FileReader("mstrx.in"));
            pw = new PrintWriter("input" + counter + ".txt");
        }
        catch (FileNotFoundException e) {
            throw new RuntimeException("RuntimeException");
        }

        new Thread(new Task14Gen()).start();
    }
}